<template>
  <div
    class="director dir-next"
    v-if="dir === 'next'"
  >
    <a href="javascript:;" @click="dirClick(dir)">&gt;</a>
  </div>
  <div
    class="director dir-prev"
    v-else-if="dir === 'prev'"
  >
    <a href="javascript:;" @click="dirClick(dir)">&lt;</a>
  </div>
</template>

<script>
export default {
  name: "CarDirector",
  props: {
    dir: String,
  },
  setup(props, { emit }) {
    const dirClick = (dir) => {
      emit("dirClick", dir);
    };

    return {
      dirClick,
    };
  },
};
</script>

<style lang="scss" scoped>
.director {
  position: absolute;
  top: 50%;
  z-index: 1;
  margin-top: -50px;
  width: 20px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  color: #fff;
  background-color: rgba(0, 0, 0, .5);

  a {
    color: #fff;
    text-decoration: none;
  }

  &.dir-next {
    right: 0;
  }
  &.dir-prev {
    left: 0;
  }
}
</style>